#include "ConsNode.h"
#include "AbsSimuEngine.h"


ConsNode::ConsNode() : m_out(new AbsIoNode(this, AbsIoNode::output)), m_cons(1)
{
    registerIoNode("output", m_out);
    registerParam("cons", m_cons);
}

ConsNode::~ConsNode() { }

QString ConsNode::lastErrorMsg()
{
    return QString();
}

QString ConsNode::displayText()
{
    return nodeName();
}

QVariantMap ConsNode::getParams()
{
    QVariantMap params;
    params.insert("cons", m_cons);
    return params;
}

void ConsNode::setParams(QVariantMap paramsMap)
{
    m_cons = paramsMap.value("cons", 1).toDouble();
}

bool ConsNode::run()
{
    qreal& out = (m_out->variable());
    out = m_cons ;
    return true;
}

QString ConsNode::nodeName()
{
    return QObject::tr("Cons");
}

